package com.li.designpattern.memento;

import java.util.ArrayList;
import java.util.List;

public class Test {
	public static void main(String[] args) {
		Originator o=new Originator();
		CareTaker careTaker=new CareTaker();
		o.setState("A");
		careTaker.addMemento(o.savetoMemento());
		o.setState("B");
		careTaker.addMemento(o.savetoMemento());
		o.setState("C");
		System.out.println(o.getState());
		o.getStateFormMemento(careTaker.getMementoFromList(0));
		System.out.println(o.getState());
		o.getStateFormMemento(careTaker.getMementoFromList(1));
		System.out.println(o.getState());
	}
}
